package com.xiaoha.pogy.services;
import com.xiaoha.pogy.dao.BorrowRepository;
import com.xiaoha.pogy.entities.Borrow;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BorrowService {

    @Autowired
    BorrowRepository borrowRepository;

    public List<Borrow> getAll(){

        return borrowRepository.findAll();
    }

    public Borrow save(Borrow borrow){

        return borrowRepository.save(borrow);
    }

    public Borrow findByBorrowId(long theId) {

        return borrowRepository.findByBorrowId(theId);
    }

    public void delete(Borrow theBorrow) {

        borrowRepository.delete(theBorrow);
    }
}
